10 DEFDBL A-Z:DEFINT I,X,Y:PI=3.141592654#
20 INPUT "a,b:",RP0,RP1
30 IF RP0<0 OR RP0>1 OR RP1<0 OR RP1>1 THEN PRINT "Invalid input.":END
40 KEY OFF:VGA=1:ON ERROR GOTO 200:SCREEN 11:ON ERROR GOTO 0
50 IF VGA=1 THEN SW=640:SH=480:RT=1:FR=90 ELSE SCREEN 1:SW=320:SH=200:RT=1.2:FR=45
60 CX=SW/2-1:CY=SH/2-1:R0=CY/(1-RP0+RP0*RP1):R1=R0*RP0:R2=R1*RP1
70 DR=R0-R1:DT0=PI/FR:DT1=R0/R1*PI/FR
80 X0=CX:Y0=CY-DR-R2:X=X0:Y=Y0:LINE (X,Y)-(X,Y),0
90 I=0:WHILE I<90 OR ABS(X-X0)>1 OR ABS(Y-Y0)>1
100 T0=I*DT0: T1=-I*DT1
110 X=CX+RT*(DR*SIN(T0)+R2*SIN(T1)): Y=CY-(DR*COS(T0)+R2*COS(T1))
120 LINE -(X,Y),3:I=I+1:WEND
130 BEEP:WHILE INPUT$(1)="":WEND
140 SCREEN 0:WIDTH 80:CLS:END
200 IF ERR=5 THEN VGA=0:RESUME NEXT ELSE ON ERROR GOTO 0

